﻿#include <iostream>
#include <QtCore>
#include <QApplication>
#include <QDir>
#include <QTextCodec>
#include "MainWindow.h"

#include "common.h"
#include "../LogRecord/LogRecord.h"
#include "CPF/CPFLauncher.h"


QString getDefaultStyle();


int main(int argc,char** argv)
{
#ifdef Q_OS_WIN
	// 设置程序异常Dump文件捕获
	SetUnhandledExceptionFilter(ExceptionFilter);
#endif

    QApplication app(argc, argv);

	QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));

    QDir::setCurrent(QCoreApplication::applicationDirPath());

	// 日志输出
	qInstallMessageHandler(LogRecord::logMessageOutput);

	app.setStyleSheet(getDefaultStyle());

	qInfo() << QStringLiteral("程序版本：") << CONST_TEST_REPORT_FULL_VERSION;

	CMainWindow mainwindow;
	mainwindow.showMaximized();

    return app.exec();
}

QString getDefaultStyle()
{
	QString strStyle;

	QFile file("style/default.qss");
	if (file.open(QIODevice::ReadOnly))
	{
		strStyle = QString(file.readAll());
	}

	return strStyle;
}

